package com.cpfmat.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.baomidou.mybatisplus.plugins.Page;
import com.cpfmat.common.Contains;
import com.cpfmat.service.IRzTabService;
import com.cpfmat.vo.CustomRzTab;

@Controller
public class RzTabController {
	@Autowired
	private IRzTabService rzTabService;

	/**
	 * 初始化日志JSP页面 直接返回到JSP页面中
	 * 
	 * @return
	 */
	@RequestMapping(path = "/manage/log/init")
	public ModelAndView init() {
		ModelAndView view = new ModelAndView("/manage/log/list");
		return view;
	}

	/**
	 * 初始化日志JSP页面 直接返回到JSP页面中
	 * 
	 * @return
	 */
	@RequestMapping(path = "/manage/log/list")
	public ModelAndView list(@RequestParam(defaultValue = "1") int pageNum,
			@RequestParam(required = false) String userName, @RequestParam(required = false) String operation,
			@RequestParam(required = false) String ip, @RequestParam(required = false) String startDate,
			@RequestParam(required = false) String endDate) {
		ModelAndView view = new ModelAndView("/manage/log/ajaxtr");
		
		Page<CustomRzTab> page = rzTabService.selectLogList(userName, startDate, endDate, operation, ip, pageNum, Contains.PAGE_SIZE);
		
		view.addObject("page",page);
		
		return view;
	}
}
